import request from '@/utils/request'

export function roles(data) {
  return request({
    url: 'admin/cmd/v1/role',
    method: 'post',
    data
  })
}

export function del(data) {
  return request({
    url: 'admin/cmd/v1/role',
    method: 'delete',
    data
  })
}

export function get(id) {
  return request({
    url: 'admin/cmd/v1/role/' + id,
    method: 'get'
  })
}

export function roleTree() {
  return request({
    url: 'admin/cmd/v1/role/roleTree',
    method: 'get'
  })
}

export function checkeds(userId) {
  return request({
    url: 'admin/cmd/v1/role/tree/' + userId,
    method: 'get'
  })
}

export function saveOrUpdate(data) {
  return request({
    url: 'admin/cmd/v1/role',
    method: 'put',
    data
  })
}

export function merge(id, data) {
  return request({
    url: 'admin/cmd/v1/role/merge/' + id,
    method: 'put',
    data
  })
}
